﻿<?PHP
header("Content-Type: text/html; charset=utf-8");
session_start();
include_once "public/DB_Oracle.php";
include_once "public/captcha.php";
if(isset($_GET['logout'])){
	session_destroy();
	}
if (!isset($_GET['cap'])) {
	$_GET['cap']= '';
}
if($_GET['cap']=='d'){
	$cap=new captcha('public/captcha/');
	$cap->generate_image();
	exit();
	}
if(isset($_POST['name'])&&isset($_POST['password'])&&isset($_POST['imagecode'])){
	$cap=new captcha();
	if($cap->check_word($_POST['imagecode'])!=1){
	echo "<script language=\"javascript\">alert('验证码错误');</script>";
	 echo "<script language=\"javascript\">window.location.href='login.php'</script>";
		exit();
		}
	if(isset($_POST['name'])&&trim($_POST['name'])!=''&&isset($_POST['password'])&&trim($_POST['password'])){
	$oracleobj=new DB_Oracle();
	$sql="select * from GPS_SYS_PEOPLE t where t.LOGIN_NAME='".$_POST['name']."' and t.PASSWORD='".md5($_POST['password'])."'";
		  $row=$oracleobj->fetch_one_array($sql);
	  if($row){
		$_SESSION['id']=$row['USER_ID'];  
		$_SESSION['name']=$_POST['name'];
	echo "<script language=\"javascript\">window.location.href='index.php'</script>";
	exit(); 
		  }
	  echo "<script language=\"javascript\">alert('用户名或者密码错误');</script>";
	  echo "<script language=\"javascript\">window.location.href='login.php'</script>";
		exit();
		}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>诺特位置服务平台</title>

<link href="css/style.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function login(){
	var zz=/[a-zA-Z0-9]{4}/;
	if(document.getElementById("name").value&&document.getElementById("password").value&&zz.test(document.getElementById("imagecode").value)){
		return true;
		}
		alert("检查自己书写是否正确");
		return false;
	}
</script>
</head>
<body style="background:url(images/log_bg.gif) repeat-x;" onload="javascript:document.getElementById('name').focus();">
  <div class="wrap" >
     <div class="logTop"><h1 class="logo"><span>诺特位置服务平台</span></h1></div> <!--end top-->
     <div class="logMain">
       <div class="logDiv">
         <div>
           <h3><span>登录</span></h3>
           <form action="login.php" method="post" onsubmit="return login()">
           <div class="log_bord">
             <table border="0" cellspacing="0" cellpadding="0" class="log_tab">
  <tr>
    <td width="50" align="right">用户名：</td>
    <td><input type="text"  id="name" name="name" class="log_txt" /></td>
  </tr>
  <tr>
    <td width="50" align="right">密 码：</td>
    <td><input type="password"  id="password" name="password" class="log_txt" /></td>
  </tr>
  <tr>
    <td width="50">验证码：</td>
    <td><input style="width:100px;" type="text" class="log_txt" name="imagecode" id="imagecode"/>&nbsp;<img style="top:20px; display:inline-block; vertical-align:middle;" src="public/login_image.php?suoji"+Math.random() onclick= this.src="public/login_image.php?suoji"+Math.random() /></td>
  </tr>
  <tr>
    <td colspan="2"><span style=" display:block; border-bottom:1px #ccc solid; height:1px;"></span></td>
    </tr>
  <tr>
    <td width="50">&nbsp;</td>
    <td align="right"><input type="submit"  class="log_btn" value=""/></td>
  </tr>
    <tr>
    <td colspan="2"><span style="display:block; padding:20px 0;"> <img src="images/log_01.jpg" width="158" height="37" /></span></td>
    </tr>
</table>
         
           </div></form>
           <h4><img src="images/pol_bot.jpg" height="14" width="265" /></h4>
         </div>
       </div><!--endDiv-->
       <div class="foot">
       <h2 style="border-bottom:2px #024387 solid;"></h2>
       <p>&copy; 河南诺特版权所有. Power By NUOTER</p>
       </div>
     </div><!--endMain-->
     
  </div><!--endwrap-->
</body>
</html>
